Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

L1 Publisher: resend stuck tx and manage nonce #1518

Merged
merged 3 commits into from
Sep 15, 2023

Conversation

BedrockSquirrel
Copy link
Collaborator

@BedrockSquirrel BedrockSquirrel commented Sep 14, 2023

Why this change is needed

If a tx is stuck pending on sepolia it brings the whole network to a halt

What changes were made as part of this PR

Keep retrying stuck transactions with the same nonce but updated gas values.

The changes:

  • instead of setting nonce when creating L1 tx, it gets set when the tx is 'prepared' at the same time as the from field and gas/gas price fields
  • L1 publisher never gives up on a sent tx where it hasn't received a receipt, it will resend with the same nonce
  • L1 publisher publishTransaction method takes responsibility for reverting the wallet nonce if something goes wrong

PR checks pre-merging

Please indicate below by ticking the checkbox that you have read and performed the required
PR checks

  • PR checks reviewed and performed

@BedrockSquirrel BedrockSquirrel marked this pull request as ready for review September 14, 2023 21:09
Copy link
Collaborator

@tudor-malene tudor-malene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

// - This method will increment the wallet nonce only if the transaction is successfully broadcast
// - This method will continue to resend the tx using latest gas price until it is successfully broadcast or the L1 is unavailable/this service is shutdown
// - **ONLY** the L1 publisher service is publishing transactions for this wallet (to avoid nonce conflicts)
func (p *Publisher) publishTransaction(tx types.TxData) error {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as an improvement for the future, this could receive a cancelable context, so you can cancel the tx from the caller if circumstances change (for ex when it's time to build another rollup).
This could be a todo

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good shout, we should have that control, added todo

@BedrockSquirrel BedrockSquirrel merged commit 64a0c5e into main Sep 15, 2023
2 checks passed
@BedrockSquirrel BedrockSquirrel deleted the matt/resend-stuck-l1-tx branch September 15, 2023 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants